﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="java.io.*" %>
<%@page import="btsm.bean.sysPro, java.util.Map"%>
<%@page contentType="text/html; charset=utf-8"%>
<html>
<head>
<title>查询与决策系统</title>
<%

				sysPro sPro = new sysPro(); 
				String strId = request.getParameter("linkId"); 
%>
<script src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=<%=sPro.getMapKey()%>" type="text/javascript"></script>
<script src="http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js" 
	type="text/javascript"></script>
		<script type='text/javascript' src='/btsm/dwr/interface/JFiberWeb.js'></script>
		<script type='text/javascript' src='/btsm/dwr/engine.js'></script>
		<script type='text/javascript' src='/btsm/dwr/util.js'></script>
<style type="text/css"> 
</style>
</head>
<body  onunload="GUnload()" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
<script type="text/javascript">

            //<![CDATA[
			var xmlHttp; 
			
			var btsBTSLIs = [];
			var defaultBTSLI = "./images/btsli/bts.png";
            var map = null;
            var mgr = null;
            var allmarkers = [];
			var allBTSCode = [];
			var allBTSName = [];
			var allBTSLevel = [];
			var allBTWRadius = [];
			var allBTSZone = [];
			var allLandform = [];
			var allRoad = [];
			var alldistanceC = [];
			var allarrivaltimeC = [];
			var alldistanceP = [];	
			var allarrivaltimeP = [];	
			var allLinkPline = [];
			var allLinkMarks = [];
			var curMarkIdx = 0;									

            var GXpolyPoints = Array();//此变量留做显示光纤线路使用。虽有赋值并未显示光纤；
			
			var allNodes = [];//光缆节点
			
            
            //基站有效作用半径，单位公里;
            var eDistance = 30;
            
            var highlightCircle;
            var currentMarker;
            var eRadius = 200;
			var bFullScreenMod = false;//全屏模式标志	
			
			var clat = <%=sPro.getCLat()%>;
			var clng = <%=sPro.getCLng()%>;


			var curZoom = 9;
			var bMesarue = 0;

			var poly;
			var count = 0;
			var points = new Array();
			var markers = new Array();
			var tooltip;
			var pDistance;
			var icon_url ="./images/";

			btsBTSLIs.length = 0;
			
<%
				Map<String, String> mapBTSLIs = sPro.getBtsLIs();
				String strBTSLI = "";
				for(int i = 0; i < mapBTSLIs.size(); ++i){
					strBTSLI = mapBTSLIs.get("btsl"+String.valueOf(i));
					if(strBTSLI == null || strBTSLI.equalsIgnoreCase("") || strBTSLI.equalsIgnoreCase("null"))
						strBTSLI = "./images/btsli/bts.png";
					%>
								btsBTSLIs.push("<%=strBTSLI%>");
					<%
				}
%>		

function addIcon(icon) { // Add icon properties

// icon.shadow= icon_url + "mm_20_shadow.png";
 icon.iconSize = new GSize(12, 20);
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(5, 1);
}

function showTooltip(marker) { // Display tooltips

 tooltip.innerHTML = marker.tooltip;
 tooltip.style.display = "block";

 // Tooltip transparency specially for IE
 if(typeof(tooltip.style.filter) == "string") {
 tooltip.style.filter = "alpha(opacity:70)";
 }

 var currtype = map.getCurrentMapType().getProjection();
 var point= currtype.fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom());
 var offset= currtype.fromLatLngToPixel(marker.getLatLng(),map.getZoom());
 var anchor = marker.getIcon().iconAnchor;
 var width = marker.getIcon().iconSize.width + 15;
// var height = tooltip.clientHeight +18;
 var height = 10;
 var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y - height)); 
 pos.apply(tooltip);
}

function leftClick(overlay, point) {

 if(point && (bMesarue > 0)) {
  count++;

  // Red marker icon
  var icon = new GIcon();
  icon.image = icon_url + "mm_20_red.png";
  addIcon(icon);
 
  // Make markers draggable
  var marker = new GMarker(point, {icon:icon, draggable:true, bouncy:false, dragCrossMove:true});
  map.addOverlay(marker);
  marker.content = count;
  markers.push(marker);
  marker.tooltip = "点"+ count;

  GEvent.addListener(marker, "mouseover", function() {
   showTooltip(marker);
  });

  GEvent.addListener(marker, "mouseout", function() {
   tooltip.style.display = "none";
  });

  // Drag listener
  GEvent.addListener(marker, "drag", function() {
   tooltip.style.display= "none";
   drawOverlay();
  });

  // Click listener to remove a marker
  GEvent.addListener(marker, "click", function() {
   tooltip.style.display = "none";

  // Find out which marker to remove
  for(var n = 0; n < markers.length; n++) {
   if(markers[n] == marker) {
    map.removeOverlay(markers[n]);
    break;
   }
  }

  // Shorten array of markers and adjust counter
  markers.splice(n, 1);
  if(markers.length == 0) {
    count = 0;
  }
   else {
    count = markers[markers.length-1].content;
    drawOverlay();
  }
  });
 drawOverlay();
 }
}

function DetailInfo(btscode, btsname){
	document.hj_myform.btscode.value=btscode;
	document.hj_myform.btsname.value=btsname;		
	document.hj_myform.seraction.value="sermod";		
	hj_myform.submit();
}

function drawOverlay(){

 if (poly) { map.removeOverlay(poly); }
 points.length = 0;

 for (i = 0; i < markers.length; i++) {
  points.push(markers[i].getLatLng());
 }

   poly = new GPolyline(points, "#ff0000", 2, .9);
   var length = poly.getLength()/1000;
   var unit = " 公里";
   pDistance.innerHTML = "距离:" + length.toFixed(3) + unit;
  map.addOverlay(poly);
}

function clearMPoints() {

 // Clear current map and reset globals
 map.removeOverlay(poly);
 
 // Find out which marker to remove
 for(var n = 0; n < markers.length; n++) {
    map.removeOverlay(markers[n]);
 }

 points.length = 0;
 markers.length = 0;
 count = 0;
 pDistance.innerHTML = "&nbsp;";
 reloadMarkers();
}

function setMesaureM(){

  if(bMesarue < 1)
    bMesarue = 1;
}

function clMesaureM(){

	if(bMesarue > 0)
    	bMesarue = 0;
}

function setQueryMbts(){
	clMesaureM();
	ShowFunElement('btsquery');
	HideFunElement('linkquery');
}
function setQueryMlink(){
	clMesaureM();
	ShowFunElement('linkquery');
	HideFunElement('btsquery');
}

function highlightCurrentMarker(){

	if (highlightCircle) {
		map.removeOverlay(highlightCircle);
		highlightCircle = null;
	}
	
	if(curZoom < 12){

		var centerPoint = new GLatLng(clat, clng);
		var radiusPoint = new GLatLng(clat - eDistance / (1.853 * 60) , clng);

		var markerPoint = currentMarker.getPoint();
		var polyPoints = Array();

		var mapNormalProj = G_NORMAL_MAP.getProjection();
		var mapZoom = map.getZoom();
		var clickedPixel = mapNormalProj.fromLatLngToPixel(markerPoint, mapZoom);

		var centerPt = mapNormalProj.fromLatLngToPixel(centerPoint, mapZoom);
		var radiusPt = mapNormalProj.fromLatLngToPixel(radiusPoint, mapZoom);                

		with (Math) {
			eRadius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2)));
			
			var polyNumSides = 90;
			var polySideLength = 4;

			for (var a = 0; a<(polyNumSides+1); a++) {
				var aRad = polySideLength*a*(Math.PI/180);
				var polyRadius = eRadius; 
				var pixelX = clickedPixel.x + polyRadius * Math.cos(aRad);
				var pixelY = clickedPixel.y + polyRadius * Math.sin(aRad);
				var polyPixel = new GPoint(pixelX,pixelY);
				var polyPoint = mapNormalProj.fromPixelToLatLng(polyPixel,mapZoom);
				polyPoints.push(polyPoint);
			}
		}
		// Using GPolygon(points,  strokeColor?,  strokeWeight?,  strokeOpacity?,  fillColor?,  fillOpacity?)
		highlightCircle = new GPolygon(polyPoints,"#000000",2,0.0,"#00ff00",.5);
		map.addOverlay(highlightCircle);
	}

	UpdateBtsInfoByID(currentMarker.value);
	
}

function clearMarkers() {
	//如果有高亮显示的基站则先删除高六显示
	if (highlightCircle) {
		map.removeOverlay(highlightCircle);
	}                    
	
	mgr.clearMarkers();
}

function reloadMarkers() {
	//setupOfficeMarkers();
	mgr.clearMarkers();
	
	mgr.addMarkers(allmarkers, 6);
	mgr.refresh();
}

function createMarker(point, strcode, iLevel) {

	var re = /^[0-9]$/;

	var tinyIcon = new GIcon();
	if (re.test(iLevel))
		tinyIcon.image = btsBTSLIs[iLevel];
	else
		tinyIcon.image = defaultBTSLI;
		 
//	tinyIcon.shadow = "./images/mm_20_shadow.png";
	tinyIcon.iconSize = new GSize(55, 80);
//	tinyIcon.shadowSize = new GSize(22, 20);
	tinyIcon.iconAnchor = new GPoint(26, 70);
	tinyIcon.infoWindowAnchor = new GPoint(5, 1);

	//  GMarkerOptions 
	markerOptions = { icon:tinyIcon , draggable: false};			

	var marker = new GMarker(point, markerOptions);

	marker.value = strcode;

	// This line highlights the marker when it's clicked
	GEvent.addListener(marker, "click", function() {
		currentMarker = marker;
		highlightCurrentMarker();
	});

	// This line highlights the marker when its moused over
	GEvent.addListener(marker, "mouseover", function() {
		currentMarker = marker;
		highlightCurrentMarker();

		ShowFunElement('btsinfo'); 
		HideFunElement('linkinfo');
					
	});

	GEvent.addListener(marker, "mouseout", function() {
		currentMarker = marker;
		RemoveHighLight();
	});

	// This line highlights the marker while dragging
	GEvent.addListener(marker, "drag", function() {
		currentMarker = marker;
		highlightCurrentMarker();	

	});

	return marker;
}            

function load() {

	map = new GMap2(document.getElementById("map_canvas"));
	map.addControl(new GLargeMapControl());
	map.addMapType(G_PHYSICAL_MAP);
	//map.addControl(new GMapTypeControl());
	map.addControl(new GMenuMapTypeControl());
	map.addControl(new GOverviewMapControl());
	map.addControl(new GScaleControl());

	map.setCenter(new GLatLng(clat, clng), curZoom);

	mgr = new MarkerManager(map, {trackMarkers:true});

	// Creates a marker at the given point with the given number label

	GEvent.addListener(map, "moveend", function() {
		var center = map.getCenter();
		HideFunElement('btsquery');
		HideFunElement('btsinfo');

		HideFunElement('linkquery');	
		HideFunElement('linkinfo');	
	});

	GEvent.addListener(map, "zoomend", function() {
		curZoom = map.getZoom();
		if(curZoom > 11)
			RemoveHighLight();
	});

	tooltip = document.createElement("div");
	tooltip.className = "tooltip";	
	map.getPane(G_MAP_MARKER_PANE).appendChild(tooltip);
	
	pDistance = document.getElementById("txtPoDistance");
	// Add listener for the click event
	GEvent.addListener(map, "click", leftClick);

	/*//"#E6E8FA" 银色
	var polyline1 = new GPolyline([
		new GLatLng(clat, clng),
		new GLatLng(clat + 0.058, clng + 0.050)
		], "#333333", 10);
	map.addOverlay(polyline1);

	GEvent.addListener(polyline1, "click", function() {
		confirm('线路单击！#333333');
	});*/

	if(('<%=strId%>' != 'null') && ('<%=strId%>' !== ""))
	{
		JFiberWeb.getSectionOutInfoListByID('<%=strId%>',"",map.getZoom(),function(sectionList)
		{		
			var blueIcon = new GIcon(G_DEFAULT_ICON);
			blueIcon.image = "./images/blue-dot.png";
			var markerOptions = { icon:blueIcon };
			var centerLng = 0.0;
			var centerLat = 0.0;
			if(sectionList !== null && sectionList !== "" )
			{
				var allLng = 0.0;
				var allLat = 0.0;
				allNodes.length = 0;				
				for(var property in sectionList)
				{
					allNodes.push(sectionList[property]);
					var point = new GLatLng(sectionList[property].lat, sectionList[property].lng); 
					if(property != 0)
					{
						var color = "#66CCFF";	
						if(sectionList[property].ocLayType == 0)
							color = "#66CCFF";	
						else if(sectionList[property].ocLayType == 1)
							color = "#99CCCC";	
						else if(sectionList[property].ocLayType == 2)
							color = "#333333";		
						var polyline = new GPolyline(
											[
											   new GLatLng(centerLat, centerLng),
											   point
											], //GLatLng()数组 
											color, //折线颜色
											5, //折线宽度
											0.5 //透明度
											); 
						polyline.title = "dddd";					
						map.addOverlay(polyline);
					}

					var gMarker;
					if(property == 0)
						gMarker =  new GMarker(point, {icon:blueIcon ,title: "起点"});
					else if(property == sectionList.length-1)
						gMarker =  new GMarker(point, {icon:blueIcon ,title: "终点"});	
					else 
						gMarker =  new GMarker(point, {icon:blueIcon});
					gMarker.value = property;

					map.addOverlay(gMarker); 

					addListener(gMarker,point,sectionList[property].ocName,
								sectionList[property].poleNum ,
								formOcLayType(sectionList[property].ocLayType),
								sectionList[property].routeInfo,
								sectionList[property].lng,
								sectionList[property].lat,
								sectionList[property].granularity,
								sectionList[property].distance);

					centerLng = sectionList[property].lng;
					centerLat = sectionList[property].lat;

					allLng = allLng + parseFloat(sectionList[property].lng);
					allLat = allLat + parseFloat(sectionList[property].lat);

				}
				map.setCenter(new GLatLng(allLat/sectionList.length, allLng/sectionList.length), curZoom);	
			}
		})

	}
}


window.onload = load;
window.onUnload = GUnload;
			
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

function refreshModelList() {

    var strBTSName = document.getElementById("strBTSName").value;

    if(strBTSName == "") {
        clearModelsList();
        return;
    }
 
    var url = "btsQueryByNameServlet?"
        + createQueryString(strBTSName) + "&ts=" + new Date().getTime();
 
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function createQueryString(strName) {

    var queryString = "strBTSName=" + strName;
    return queryString;

}

function handleStateChange() {

    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            updateModelsList();
        }
    }
}

function updateModelsList() {

    clearModelsList();

    var models = document.getElementById("models");
    var properties = xmlHttp.responseXML.getElementsByTagName("property");
    var option = null;
    var property = null;
    var btsName, btsCode, btszone, landform, btsLat, btsLng, btsLevel, btsWRadius;
	var btsRoad, btsalldistanceC, btsarrivaltimeC,  bdistanceP, barrivaltimeP;
    var marker, point;

    allmarkers.length = 0;
    GXpolyPoints.length = 0;
	mgr.clearMarkers();

	allBTSCode.length = 0;
	allBTSName.length = 0;
	allBTSLevel.length = 0;
	allBTWRadius.length = 0;
	allBTSZone.length = 0;
	allLandform.length = 0;
	allRoad.length = 0;
	alldistanceC.length = 0;
	allarrivaltimeC.length = 0;
	alldistanceP.length = 0;	
	allarrivaltimeP.length = 0;	

    for(var i = 0; i < properties.length; i++) {
        
        property = properties[i];
        option = document.createElement("option");
        btsCode = property.getElementsByTagName("btsCode")[0].firstChild.nodeValue;
	    btsName = property.getElementsByTagName("btsName")[0].firstChild.nodeValue;
		btszone = property.getElementsByTagName("btszone")[0].firstChild.nodeValue;
		landform = property.getElementsByTagName("landform")[0].firstChild.nodeValue;
        btsLat = property.getElementsByTagName("btsLat")[0].firstChild.nodeValue;
        btsLng = property.getElementsByTagName("btsLng")[0].firstChild.nodeValue;
		btsLevel = property.getElementsByTagName("btsLevel")[0].firstChild.nodeValue;
		btsWRadius = property.getElementsByTagName("wRadius")[0].firstChild.nodeValue;
		
		btsRoad = property.getElementsByTagName("btsRoad")[0].firstChild.nodeValue;
		btsalldistanceC = property.getElementsByTagName("distanceC")[0].firstChild.nodeValue;
		btsarrivaltimeC = property.getElementsByTagName("arrivaltimeC")[0].firstChild.nodeValue;
		bdistanceP = property.getElementsByTagName("distanceP")[0].firstChild.nodeValue;
		barrivaltimeP = property.getElementsByTagName("arrivaltimeP")[0].firstChild.nodeValue;
		
        point = new GLatLng(btsLat, btsLng);
        marker = createMarker(point, i, btsLevel);
        allmarkers.push(marker);
        GXpolyPoints.push(point);
		allBTSCode.push(btsCode);
		allBTSName.push(btsName);

		allBTSLevel.push(btsLevel);
		allBTWRadius.push(btsWRadius);

		allBTSZone.push(btszone);
		allLandform.push(landform);
		allRoad.push(btsRoad);
		alldistanceC.push(btsalldistanceC);
		allarrivaltimeC.push(btsarrivaltimeC);
		alldistanceP.push(bdistanceP);	
		allarrivaltimeP.push(barrivaltimeP);

        option.appendChild(document.createTextNode(btsCode + btsName));
        models.appendChild(option);

    }
	
    //如果有高亮显示的基站则先删除高亮显示
    if (highlightCircle) {
         map.removeOverlay(highlightCircle);
    }        
    mgr.addMarkers(allmarkers, 2);//
    mgr.refresh();

}

function UpdateMapFocus() {
    var models = document.getElementById("models");

	map.panTo(GXpolyPoints[models.selectedIndex]);
    
	currentMarker = allmarkers[models.selectedIndex];  
	highlightCurrentMarker();
}

function UpdateBtsInfoByID(markIdx){

	curMarkIdx = markIdx;

	document.getElementById("BtsInfoCode").innerHTML = "编号:<B><I>"+allBTSCode[markIdx]+"</I></B>";
	document.getElementById("BtsInfoName").innerHTML = "基站名称:<B><I>"+allBTSName[markIdx]+"</I></B>";
	document.getElementById("btszone").innerHTML = "区域:<B><I>"+allBTSZone[markIdx]+"</I></B>";
	document.getElementById("landform").innerHTML = "地形:<B><I>"+allLandform[markIdx]+"</I></B>";
	document.getElementById("btsRoad").innerHTML = "路面<B><I>"+allRoad[markIdx]+"</I></B>";
	document.getElementById("distanceCP").innerHTML = "到达距离:<B><I>"+alldistanceC[markIdx] + "公里/" +  alldistanceP[markIdx]+"米</I></B>"; 
	document.getElementById("arrivaltimeCP").innerHTML = "到达时间:<B><I>"+ allarrivaltimeC[markIdx] + "分钟/" + allarrivaltimeP[markIdx]+"分钟</I></B>";		

}

function clearModelsList() {
    var models = document.getElementById("models");
    while(models.childNodes.length > 0) {
        models.removeChild(models.childNodes[0]);
    }
}

function RemoveHighLight(){
    //如果有高亮显示的基站则删除
    if (highlightCircle) {
         map.removeOverlay(highlightCircle);
		 highlightCircle = null;
    } 	
}

function clearMarkersbts(){
 //如果有高亮显示的基站则删除
 for(var n = 0; n < allmarkers.length; n++) {
    map.removeOverlay(allmarkers[n]);
 }
}

function clearMarkerslink(){
 //清除中继段显示
 var iLen = allLinkMarks.length;
 for(var n = 0; n < allLinkPline.length; n++) {
    map.removeOverlay(allLinkPline[n]);
	map.removeOverlay(allLinkMarks[n]);
 }
 if(allLinkMarks.length > 0)
	map.removeOverlay(allLinkMarks[iLen - 1]);
	
	allLinkPline.length = 0;
	allLinkMarks.length = 0;
}


function ShowFunElement(strElement){
  document.getElementById(strElement).style.display = "block";
}

function HideFunElement(strElement){
  document.getElementById(strElement).style.display = "none";
}	
    //]]>
/////////////////////////////////////////////////
function formOcLayType(value)
{
	if(value == '0')
		return '电杆';
	else if(value == '1')	
		return '管道';
	else
		return '直埋';
}

function addListener(pointMarker,latlng,ocName,poleNum,ocLayType,routeInfo,lng,lat,granularity,distance) {  
    GEvent.addListener(pointMarker, "mouseover", function(){  
		UpdateNodeInfo(ocName,poleNum,ocLayType,routeInfo,lng,lat,granularity,distance);	
		ShowFunElement('linkinfo'); 
		HideFunElement('btsinfo');
    });  
} 

function AddItem(obj,text,value)
{
	var varItem = new Option(text,value);
	obj.options.add(varItem);
}

var querySectionId = "";
function refreshModelListLink() 
{
    var inputValue = document.getElementById("strBTSName_ID").value;	
	var arryValue = inputValue.split(" ");
	var strBTSName = "";
	var strDistance = "";
	var isInputDistance = false;
	if(arryValue.length == 2)
	{
		strBTSName = arryValue[0];
		strDistance = arryValue[1];
		isInputDistance = true;
	}else
	{
		strBTSName = inputValue;
		isInputDistance = false;
		querySectionId = "";
	}
	JFiberWeb.getSectionOutInfoListByInputValue(strBTSName,strDistance,function(objList)
	{
		DWRUtil.removeAllOptions("sectionListID" );   		 
		if(objList!=null)
		{
			var obj = document.getElementById("sectionListID");
			for(var property in objList)
			{
				if(isInputDistance)
					querySectionId = objList[property].id;
				else
					querySectionId = "";
				AddItem(obj,objList[property].ocName,objList[property].ocid); 
			}
			//DWRUtil.addOptions('sectionListID',objMap); 
		}else{
			DWRUtil.addOptions('sectionListID',['Nothing Data...']);
		}
	}) 
}

function showSectionMap(bSetC)
{
    var objSectionID = document.getElementById("sectionListID");

	JFiberWeb.getSectionOutInfoListByID(objSectionID.value,querySectionId,map.getZoom(),function(sectionList)
	{
		 
		var blueIcon = new GIcon(G_DEFAULT_ICON); 
		blueIcon.image = "./images/blue-dot.png";
		var markerOptions = { icon:blueIcon }; 
		var centerLng = 0.0;
		var centerLat = 0.0; 
		if(sectionList !== null && sectionList !== "" )
		{
			var allLng = 0.0;
			var allLat = 0.0;
			allNodes.length = 0;
		
			clearMarkerslink();			

			for(var property in sectionList)
			{
				allNodes.push(sectionList[property]);
				var point = new GLatLng(sectionList[property].lat, sectionList[property].lng); 
				if(property != 0)
				{
					var color = "#66CCFF";	
					if(sectionList[property].ocLayType == 0)
						color = "#66CCFF";	
					else if(sectionList[property].ocLayType == 1)
						color = "#99CCCC";	
					else if(sectionList[property].ocLayType == 2)
						color = "#333333";	

					var polyline = new GPolyline(
										[
										   new GLatLng(centerLat, centerLng),
										   point
										], //GLatLng()数组 
										color, //折线颜色
										5, //折线宽度
										0.5 //透明度
										); 
					polyline.title = "dddd";					
					map.addOverlay(polyline);
					
					allLinkPline.push(polyline);
				}
				 
				var gMarker;
				
				if(querySectionId != "" && querySectionId == sectionList[property].id)
				{
					var selectIcon = new GIcon(G_DEFAULT_ICON); 
					var markerSelectOptions = { icon:selectIcon };
					gMarker = new GMarker(point, markerSelectOptions);
				}else
				{
					if(property == 0)
						gMarker =  new GMarker(point, {icon:blueIcon ,title: "起点"});
					else if(property == sectionList.length-1)
						gMarker =  new GMarker(point, {icon:blueIcon ,title: "终点"});	
					else 
						gMarker =  new GMarker(point, {icon:blueIcon});
				}
				gMarker.value = property;						
														
				map.addOverlay(gMarker); 
				
				allLinkMarks.push(gMarker);


				addListener(gMarker,point,sectionList[property].ocName,
							sectionList[property].poleNum ,
							formOcLayType(sectionList[property].ocLayType),
							sectionList[property].routeInfo,
							sectionList[property].lng,
							sectionList[property].lat,
							sectionList[property].granularity,
							sectionList[property].distance);

				centerLng = sectionList[property].lng;
				centerLat = sectionList[property].lat;

				allLng = allLng + parseFloat(sectionList[property].lng);
				allLat = allLat + parseFloat(sectionList[property].lat);

			}
			if(bSetC == '1')	
				map.setCenter(new GLatLng(allLat/sectionList.length, allLng/sectionList.length), curZoom);
		}	 

	})
}

function UpdateNodeInfo(ocName,poleNum,ocLayType,routeInfo,lng,lat,granularity,distance)
{	
	document.getElementById("tdOcName").innerHTML = "中继段名称:<B><I>"+ocName+"</I></B>";
	document.getElementById("tdLng").innerHTML = "经度:<B><I>"+lng+"</I></B>";
	document.getElementById("tdLat").innerHTML = "维度:<B><I>"+lat+"</I></B>";
	document.getElementById("tdPoleNum").innerHTML = "杆号:<B><I>"+poleNum+"</I></B>";
	document.getElementById("tdDistance").innerHTML = "与前一节点长度:<B><I>"+distance+"</I></B>";
	document.getElementById("tdGranularity").innerHTML = "本地累加长度:<B><I>"+granularity+"</I></B>";
	document.getElementById("tdOcLayType").innerHTML = "敷设方式:<B><I>"+ocLayType+"</I></B>";
	document.getElementById("tdRouteInfo").innerHTML = "路由信息:<B><I>"+routeInfo+"</I></B>";
}

</script>

                                    <%
            String jspName = request.getRequestURI();
            jspName = jspName.substring(jspName.lastIndexOf("/") + 1);
                                    %>
        <FORM name="hj_myform" action="./pages/station/environment.jsp" method="post">
            <input type="hidden" name="filesnames" value=<%=jspName%>>
            <input type="hidden" name="seraction" value="sermodp">
			<input type="hidden" name="btscode" value="ddg">
			<input type="hidden" name="btsname" value="ddg">
        </FORM>
<table width="100%" border="0">
	<tr>
		<td colspan="11"><div id="map_canvas" style="width: 100%; height: 490px"></div></td>
	</tr>
	<tr>
		<td width="80px" align="center"><input type="button" name="btquerybts" value="基站查询" onClick="setQueryMbts();"></td>
		<td width="80px" align="center"><input id="btnClear" name="btnClear" type="button" onClick="clearMarkersbts()" value="隐藏基站"></td>
		<td width="80px" align="center"><input id="reLoad" name="reload" type="button" onClick="reloadMarkers()" value="加载基站"></td>
		<td width="10px" align="center">&nbsp;</td>
		<td width="80px" align="center"><input type="button" name="btquerylink" value="光缆查询" onClick="setQueryMlink();"></td>
		<td width="80px" align="center"><input type="button" id="btnClearlink" name="btnClearlink" onClick="clearMarkerslink();" value="隐藏光缆"></td>
		<td width="80px" align="center"><input id="reloadLink" name="reloadLink" type="button" onClick="showSectionMap('0');" value="加载光缆"></td>
		<td width="10px" align="center">&nbsp;</td>
		<td width="80px" align="center"><input type="button" name="btMesaure" value="　测距　" onClick="setMesaureM()"></td>
		<td width="80px" align="center"><input id="btnClearMap" name="btnClearMPoints" type="button" onClick="clearMPoints()" value="清除测量点"></td>
		<td height="20" align="center"><div id="txtPoDistance"></div></td>
	</tr>
</table>
<div id="btsquery" style="position:absolute; left:730px; top:170px; width:10px; height:10px; display:none">
	<table width="100%" height="291" align="center" border="0" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
		<tr>
			<td height="32" colspan="2" align="center" bgcolor="#FF9900"><span class="style1">基站查询</span></td>
		</tr>
		<tr>
			<td height="22" colspan="2" align="left" bgcolor="#99CCCC">请输入关键字(名称或者编号)：</td>
		</tr>
		<tr>
			<td width="171" height="25" bgcolor="EDF2FC"><input name="strBTSName" type="text" id="strBTSName" onKeyDown="if(event.keyCode==13){refreshModelList()};" size="21"></td>
			<td width="85" bgcolor="EDF2FC"><input name="button" type="button" id="btqQuery" onClick="refreshModelList();" value="　查询　"></td>
		</tr>
		<tr>
			<td height="143" bgcolor="EDF2FC" colspan="2"><select name="select" size="10" id="models" style="width:260px;height:200px" onkeypress="UpdateMapFocus();" onclick="UpdateMapFocus();">
				</select></td>
		</tr>
	</table>
</div>
<div id="btsinfo" style="position:absolute; left:98px; top:150px; height:248px; display:none">
	<table width="220" height="248" bgcolor="#996633" align="center" border="0" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
		<tr>
			<td height="27" align="center" bgcolor="#FF9900"><div id="BtsInfoName"> </div></td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="BtsInfoCode">&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="btszone">&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="landform">&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="btsRoad">&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="distanceCP">&nbsp;</td>
		</tr>
		<tr>
			<td bgcolor="EDF2FC" id="arrivaltimeCP">&nbsp;</td>
		</tr>
		<tr>
			<td align="center" bgcolor="EDF2FC"><input type="hidden" name="detailBtn" value="详细信息" onClick="DetailInfo(allBTSCode[curMarkIdx], allBTSName[curMarkIdx]);"> <input type="button" name="detailBtn" value="　确定　" onClick="HideFunElement('btsinfo');"></td>
		</tr>
	</table>
</div>

<div id="linkquery" style="position:absolute; left:730px; top:170px; width:10px; height:10px; display:none">
<table width="100%" height="291" align="center" border="0" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
  <tr>
    <td height="32" colspan="2" align="center" bgcolor="#FF9900"><span class="style1">光纤环查询</span></td>
  </tr>
  <tr>
    <td height="22" colspan="2" align="left" bgcolor="#99CCCC">请输入关键字(名称或者编号)：</td>
  </tr>
  <tr>
    <td width="171" height="25" bgcolor="EDF2FC">
		<input name="strBTSName" type="text" id="strBTSName_ID" onKeyDown="if(event.keyCode==13){refreshModelListLink()};" size="21">
	</td>
    <td width="85" bgcolor="EDF2FC">
		<input name="button" type="button" value="　查询　" onClick="refreshModelListLink()" >
	</td>
  </tr>
  <tr>
    <td height="143" bgcolor="EDF2FC" colspan="2">
		<select name="select" id="sectionListID" size="10" style="width:260px;height:200px" onkeypress="showSectionMap('1');" onclick="showSectionMap('1');">
		</select>
	</td>
  </tr>
</table>
</div>

<div id="linkinfo" style="position:absolute; left:98px; top:150px; width:188px;display:none">
<table width="220" height="280" bgcolor="#996633" align="center" border="0" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
	<tr><td height="27" align="center" bgcolor="#FF9900" id="tdOcName"></td></tr>
	<tr>
		<td bgcolor="EDF2FC" id="tdLng">&nbsp;</td>
	</tr>
	<tr>
		<td bgcolor="EDF2FC" id="tdLat">&nbsp;</td>
	</tr>
	<tr><td bgcolor="EDF2FC" id="tdPoleNum">&nbsp;</td></tr>
	<tr>
		<td bgcolor="EDF2FC" id="tdDistance">&nbsp;</td>
	</tr>
	<tr><td bgcolor="EDF2FC" id="tdGranularity">&nbsp;</td></tr>
	<tr><td bgcolor="EDF2FC" id="tdOcLayType">&nbsp;</td></tr>
	<tr><td bgcolor="EDF2FC" id="tdRouteInfo">&nbsp;</td></tr>
	<tr>
		<td align="center" bgcolor="EDF2FC"><input type="button" name="detailBtn" value="　确定　" onClick="HideFunElement('linkinfo');"></td>
	</tr>
</table>
</div>

</body>
</html>
